package com.xmhmyh.generalframework.framework.config;

import com.xmhmyh.generalframework.framework.redisQueue.consumers.RedisQueueConsumerContainer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * redis队列配置
 */
@Configuration
@Slf4j
public class RedisQueueConfig {

    /**
     * 初始化完毕后调取 init
     * 添加消费者的方法如下
     * redisQueueConsumerContainer.addConsumer(new MyConsumer());
     *
     * @return
     */
    @Bean(initMethod = "init", destroyMethod = "destroy")
    public RedisQueueConsumerContainer redisQueueConsumerContainer() {
        log.info("redis队列开始加载");
        RedisQueueConsumerContainer redisQueueConsumerContainer = new RedisQueueConsumerContainer();
        /**
         * 这里添加消费者容器
         */
        // redisQueueConsumerContainer.addConsumer(new xxxQueue());
        log.info("redis队列开始加载成功");
        return redisQueueConsumerContainer;
    }

}
